<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>SUOYUEの友链管理</title>

  <link rel="shortcut icon" th:href="@{/images/favicon.ico}" />
  <link rel="stylesheet" href="../../static/lib/Semantic-UI/semantic.min.css" th:href="@{/lib/Semantic-UI/semantic.min.css}">
  <link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}">
</head>
<body>

  <!--导航栏-->
  <nav class="ui inverted gird-header" >
    <div class="ui container">
      <div class="ui inverted secondary stackable menu">
        <h2 class="ui olive header item" style="font-family: STSong">SUOYUEの管理后台</h2>
        <a href="#" th:href="@{/admin/blogs}" class="m-item item m-mobile-hide"><i class="home icon"></i>文章管理</a>
        <a href="#" th:href="@{/admin/types}" class="m-item item m-mobile-hide"><i class="clone outline icon"></i>分类管理</a>
        <a href="#" th:href="@{/admin/friendlinks}" class="m-item active item m-mobile-hide"><i class="pencil alternate icon"></i>友链管理</a>
        <a href="#" th:href="@{/admin/images}" class="m-item item m-mobile-hide"><i class="images icon"></i>图片管理</a>
        <div class="right m-item m-mobile-hide menu">
          <div class="ui dropdown  item">
            <div class="text">
              <img class="ui avatar image" src="../../static/images/me.jpg" th:src="@{/images/me.jpg}">
              <span th:text="${session.user.nickname}">suoyue_zhan</span>
            </div>
            <i class="dropdown icon"></i>
            <div class="menu">
              <a href="" th:href="@{/admin/logout}" class="item">注销</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </nav>
  <div class="m-padded-tb-hugex">
    <div class="ui attached pointing menu">
      <div class="ui container">
        <div class="right menu">
          <a href="#" th:href="@{/admin/friendlinks/input}" class=" item">发布</a>
          <a href="#" th:href="@{/admin/friendlinks}" class="teal active item">列表</a>
        </div>
      </div>
    </div>
  </div>

  <!--中间内容-->
  <div  class="m-padded-tb-large">
    <div class="ui container">
      <!--消息提示-->
      <div class="ui success message" th:unless="${#strings.isEmpty(message)}">
        <i class="close icon"></i>
        <div class="header">提示：<span th:text="${message}" style="color: #FF0000">三思后行-有始有终</span></div>
      </div>

      <table class="ui compact teal table">
        <thead>
          <tr align="center">
            <th>ID</th>
            <th>网址类型</th>
            <th>博客名称</th>
            <th>博客地址</th>
            <th>图片地址</th>
            <th>添加时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr th:each="blog: ${pageInfo}" align="center" >
            <td th:text="${blog.id}">1</td>
            <td th:text="${blog.uid}==1 ? '友链' : '自荐' ">自荐或友链</td>
            <td th:text="${blog.blogname}">SUOYUE</td>
            <td th:text="${blog.blogaddress}" >https://suoyue_zhan.net.cn/</td>
            <td th:text="${blog.pictureaddress}">https://suoyue_zhan.net.cn/</td>
            <td th:text="${#dates.format(blog.createTime,'yyyy-MM-dd HH:mm')}">2020-01-02 09:45</td>
            <td>
              <a href="#" th:href="@{/admin/friendlinks/{id}/input(id=${blog.id})}" class="ui mini teal basic button">编辑</a>
              <a href="#" th:href="@{/admin/friendlinks/{id}/delete(id=${blog.id})}" onclick="return confirm('确定要删除该友链吗？三思啊! 删了可就没了！')" class="ui mini red basic button">删除</a>
            </td>
          </tr>
        </tbody>
        <tfoot>
          <tr>
            <th colspan="7" >
              <div class="ui inverted divided stackable grid">
                <div class="three wide column" align="center">
                  <a th:href="@{/admin/friendlinks(pageNum=${pageInfo.pageNum}-1)}" class="item">上一页</a>
                </div>

                <div class="ten wide column" align="center">
                  <p>第 <span th:text="${pageInfo.pageNum}"></span> 页，共 <span th:text="${pageInfo.pages}"></span> 页，有 <span th:text="${pageInfo.total}"></span> 篇文章</p>
                </div>

                <div class="three wide column" align="center">
                  <a th:href="@{/admin/friendlinks(pageNum=${pageInfo.pageNum}+1)}" class="item">下一页</a>
                </div>
              </div>
              <div align="center">
                <a href="#" th:href="@{/admin/friendlinks/input}">
                  <button type="button" class="ui teal button m-mobile-wide m-margin-top"><i class="pencil icon"></i>新增</button>
                </a>
              </div>
            </th>
          </tr>
        </tfoot>
      </table>
    </div>
  </div>

  <br>
  <br>
  <!--底部栏-->
<footer class="ui inverted vertical segment m-padded-tb-massive m-opacity" th:replace="_fragments :: footer">
  <!--容器-->

</footer>

  <script src="../../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
  <script src="../../static/lib/Semantic-UI/semantic.min.js" th:src="@{/lib/Semantic-UI/semantic.min.js}"></script>

  <script>
    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
      on : 'hover'
    });

    //消息提示关闭初始化
    $('.message .close')
      .on('click', function () {
        $(this)
          .closest('.message')
          .transition('fade');
      });
  </script>
</body>
</html>